<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="Bookmark" href="/favicon.ico">
    <link rel="Shortcut Icon" href="/favicon.ico" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="lib/html5shiv.js"></script>
    <script type="text/javascript" src="lib/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="../static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="../lib/Hui-iconfont/1.0.9/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="../static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/style.css" />
    <link rel="stylesheet" href="./../lib/layui/css/layui.css">
    <!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
    <title>提现列表</title>
</head>

<body>
    <nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 提现管理 <span
            class="c-gray en">&gt;</span>
        提现列表 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);"
            title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a></nav>
    <div class="page-container">
        <div>
            <label for="">账号：</label>
            <input type="text" class="input-text" style="width:150px" placeholder="输入账号" id="mobile" name="">
            <label for="">状态：</label>
            <select name="" class="input-text" id="usrecompStatus" style="width:15%;">
                <option value="">-请选择-</option>
                <option value="0">待审核</option>
                <option value="1">审核未通过</option>
                <option value="2">用户已取消</option>
                <option value="3">提现成功</option>
            </select>
            <button type="submit" class=" btn btn-success" id="search" name="" data-type="reload"><i class="Hui-iconfont">&#xe665;</i>
                搜索</button>
        </div>
        <table class="layui-hide" id="getCashList" lay-filter="getCashList"></table>
    </div>
    <script type="text/javascript" src="../lib/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="./../static/js/common.js"></script>
    <script type="text/javascript" src="../lib/layer/2.4/layer.js"></script>
    <script type="text/javascript" src="../static/h-ui/js/H-ui.min.js"></script>
    <script type="text/javascript" src="../static/h-ui.admin/js/H-ui.admin.js"></script>
    <script type="text/javascript" src="./../lib/layui/layui.js"></script>
    <script type="text/html" id="operation">
        {{#  if(d.status == 0){ }}
        <a  title="是否提现" lay-event="sureCash" class=""><i class="Hui-iconfont">&#xe676;</i></a>
        <a  title="拒绝提现" lay-event="refuse" class=""><i class="Hui-iconfont">&#xe6dd;</i></a>
        {{#  } }}
    </script>
    <script>
        layui.use('table', function () {
            var table = layui.table;
          var insTable = table.render({
                elem: '#getCashList',
                cellMinWidth: 80,
                url: admin_url + '/kvmWithdrawal/withdrawalList',
                // id为重置表格，进行搜索
                id: 'reload',
                request: {
                    pageName: 'page',
                    limitName: 'size'
                },
                // 传输模式
                // contentType: 'application/json',
                paresData: function (res) {
                    return {
                        'data': res.data
                    }
                },
                response: {
                    statusCode: 200
                },
                // // 传入数据
                where: {
                    tokenUserId: userId,
                    token: token
                },
                // 回调
                done: function (res, curr, count) {
                },
                method: 'post',
                page: 'true',
                cols: [[
                    { checkbox: true, align: 'center' },
                    // { field: 'userId', title: '用户ID', align: 'center', width: 80 },
                    { field: 'mobile', title: '账号', align: 'center' },
                    { field: 'accountName', title: '真实姓名', align: 'center' },
                    { field: 'total', title: '提现金额', align: 'center' },
                    { field: 'fcNum', title: '手续费', align: 'center' },
                    { field: 'total', title: '到账金额', align: 'center',templet:function(obj){
                        return '<span>' + (obj.total - obj.fcNum).toFixed(2) + '</span>'
                    } },
                    { field: 'type', title: ' 支付宝/银行卡账号', align: 'center',templet:function(obj){
                        if(obj.type == 0){
                            return '<span class="layui-badge">支付宝</span>'
                        }else if(obj.type == 1){
                            return '<span class="layui-badge layui-bg-orange">银行卡</span>'
                        }else if(obj.type == null){
                            return '<span></span>'
                        }
                    } },
                    { field: 'bankName', title: '提现银行名称', align: 'center',templet:function(obj){
                        if(obj.bankName == null || obj.bankName == ''){
                            return '<span></span>'
                        }else{
                            return '<span>' + obj.bankName + '</span>'
                        }
                    } },
                    { field: 'account', title: '提现账号', align: 'center' },
                    { field: 'wdTime', title: '申请时间', align: 'center' },
                    { field: 'status', title: '状态', align: 'center',templet:function(obj){
                        if(obj.status == 0){
                            return '<span class="layui-badge layui-bg-blue">待审核</span>'
                        }else if(obj.status == 1){
                            return '<span class="layui-badge layui-bg-cyan">审核未通过</span>'
                        }else if(obj.status == 2){
                            return '<span class="layui-badge layui-bg-green">用户已取消</span>'
                        }else if(obj.status == 3){
                            return '<span class="layui-badge">提现成功</span>'
                        }
                    } },
                    { field: 'des', title: '备注', align: 'center' },
                    { toolbar: '#operation', title: '操作', align: 'center' }
                ]]
            })
            $('#search').on('click', function () {
                var mobile = $("#mobile").val(),
                    status = $("#usrecompStatus  option:selected" ).val();
                insTable.reload({
                    where:{
                        "token": token,
                        "tokenUserId": userId,
                        "mobile":mobile,
                        "status":status
                    }, page: {
                        curr: 1
                    }
                })
            });
            // 监听行操作栏事件。。可直接传值..
            table.on('tool(getCashList)', function (obj) {
                var id = obj.data.id;
                if (obj.event === 'sure') {
                    layer.confirm('确认提现成功?', function () {
                         $.ajax({
                            type: 'POST',
                            xhrFields: { withCredentials: true },
                            data: {tokenUserId: userId, token: token,id:id },
                            url: admin_url + "/kvmWithdrawal/withdrawal",
                            success: function (data) {
                                if (data.code == 200) {
                                    layer.msg('确认成功', {
                                        end: function () {
                                            time: 400,
                                                // location.replace(location.href)
                                                $(".layui-laypage-btn").click();
                                        }
                                    })
                                } else {
                                    layer.msg(data.msg)
                                }
                            }
                        })
                    })
                } else if (obj.event === 'refuse') {
                    layer.confirm('<textarea class="input-text" id="trade" style="height:100px;resize:none" placeholder="请输入审核不通过的理由"></textarea>', { title: "审核不通过" }, function () {
                        var trade = $("#trade").val();
                        $.ajax({
                            type: 'POST',
                            xhrFields: { withCredentials: true },
                            data: {tokenUserId: userId, token: token,id:id,des:trade  },
                            url:admin_url + "/kvmWithdrawal/withdrawalFaild",
                            success: function (data) {
                                if (data.code == 200) {
                                    layer.msg(data.msg, {
                                        end: function () {
                                            time: 400,
                                                // location.replace(location.href)
                                                $(".layui-laypage-btn").click();
                                        }
                                    })
                                } else {
                                    layer.msg(data.msg)
                                }
                            }
                        })
                    })
                }else if(obj.event == 'sureCash'){
                    layer.confirm('审核通过?',function(){
                         $.ajax({
                            type: 'POST',
                            xhrFields: { withCredentials: true },
                            data: {tokenUserId: userId, token: token,id:id  },
                            url:admin_url + "/kvmWithdrawal/withdrawal",
                            success: function (data) {
                                if (data.code == 200) {
                                    layer.msg('审核成功', {
                                        end: function () {
                                            time: 400,
                                                // location.replace(location.href)
                                                $(".layui-laypage-btn").click();
                                        }
                                    })
                                } else {
                                    layer.msg(data.msg)
                                }
                            }
                        })
                    })
                }
            })

        })
    </script>
</body>

</html>